/*
 * TelaAguarde.java
 *
 * Created on 9 de Maio de 2005, 17:22
 */

package Janelas;

/**
 *
 * @author  Nucleo
 */
public class TelaAguarde extends javax.swing.JDialog implements Runnable{
    
    /** Creates new form TelaAguarde */
    public TelaAguarde(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setSize(243,83);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();

        getContentPane().setLayout(null);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        jPanel1.setLayout(null);

        jPanel1.setBorder(new javax.swing.border.EtchedBorder());
        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel1.setText("Aguarde...");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(90, 30, 90, 17);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(0, 0, 240, 80);

        pack();
    }//GEN-END:initComponents
    public void run()
    {
        this.show();
        roda r = new roda(jLabel1);
        r.start();
        while(this.isActive()) {
        }
        r.stop();
    }
    class roda extends java.lang.Thread {
        javax.swing.JLabel Lab;
        public roda(javax.swing.JLabel jL) {
            Lab = jL;
        }
        public void run() {
            java.awt.Rectangle labelRect = Lab.getBounds();
            labelRect.x = 0;
            labelRect.y = 0;
            while(true) {
                Lab.setText("Aguarde");
                Lab.paintImmediately( labelRect );
                try {
                    this.sleep((int)Math.random()*1000);
                } catch(java.lang.InterruptedException e) {
                    
                }
                Lab.setText("Aguarde.");
                Lab.paintImmediately( labelRect );
                try {
                    this.sleep((int)Math.random()*1000);
                } catch(java.lang.InterruptedException e) {
                    
                }
                Lab.setText("Aguarde..");
                Lab.paintImmediately( labelRect );
                try {
                    this.sleep((int)Math.random()*1000);
                } catch(java.lang.InterruptedException e) {
                    
                }
                Lab.setText("Aguarde...");
                Lab.paintImmediately( labelRect );
                try {
                    this.sleep((int)Math.random()*1000);
                } catch(java.lang.InterruptedException e) {
                    
                }
            }
        }
    }
    /**
     * @param args the command line arguments
     */
            /*public static void main(String args[]) {
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        new TelaAguarde(new javax.swing.JFrame(), true).setVisible(true);
                    }
                });
            }*/
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
    
}
